UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eRRZ7oOL9c8Blmv4Qzp67j123k2HOD0p4WBPo/FMVPA=' 
WHERE 
  key_id = '39519500be447b18fe744c22f14a9ad46d022a405370b6a6c6928ec26e916355' 
  AND (
    token = 'eRRZ7oOL9c8Blmv4Qzp67j123k2HOD0p4WBPo/FMVPA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041