UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EyJy6gEPbs4m98h3598qRsrqhyc0HIzcmeaMIQW/Whc=' 
WHERE 
  key_id = '7e0dbc6fe15e3f566c8c2d45b733e387b08e3526a6a28f3840c8ff6855fee189' 
  AND (
    token = 'EyJy6gEPbs4m98h3598qRsrqhyc0HIzcmeaMIQW/Whc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030