UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CjWAvicaD8GstMFrDI1CEgPZqA+sEFmCh+wXFgDRnok=' 
WHERE 
  key_id = '55d7a122147b53495c6e120e4eaf40dc728f64def42e8f420ace510b129cadc9' 
  AND (
    token = 'CjWAvicaD8GstMFrDI1CEgPZqA+sEFmCh+wXFgDRnok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035