UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K0AdEeHXLlFscsfl0UveFyOUu/Y43gWEhTFQjnOdlNE=' 
WHERE 
  key_id = '7f61bb95a1313892288e442dc612be94da8b433b0751de11679a128b2db4e443' 
  AND (
    token = 'K0AdEeHXLlFscsfl0UveFyOUu/Y43gWEhTFQjnOdlNE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026