UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '41uIyhHkKpd5n9TnH+R8lwRYtSqhKns3LYiMVFIv54Q=' 
WHERE 
  key_id = '0fa8d5bcf29b205543455f61c4cd9a78e2ce81a377c66a66f364846ab28face6' 
  AND (
    token = '41uIyhHkKpd5n9TnH+R8lwRYtSqhKns3LYiMVFIv54Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042