UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EJmPJNmd6inELUJEglYXQcOScfQq8J4bSTN6TQRcQgc=' 
WHERE 
  key_id = 'bd87ffe20b74f32801b7b943b70b85646a868b0159d341028e4a3840f511cffd' 
  AND (
    token = 'EJmPJNmd6inELUJEglYXQcOScfQq8J4bSTN6TQRcQgc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067