UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rdE5uatIpFiM4l5y3Dn8zTiqNKHd259nVkm8/n+jOm4=' 
WHERE 
  key_id = '328a394cd2f51ad336386ceab9afa1e58e21b47b0619bc0d05b454cc3e72c44f' 
  AND (
    token = 'rdE5uatIpFiM4l5y3Dn8zTiqNKHd259nVkm8/n+jOm4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022