UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oPcEiAC6itNgppxynE793nKCCsVtTR+qxSIWICOPAQc=' 
WHERE 
  key_id = 'ec302e12d5c93a352957a1d1022921725f778c6f50a02f70b3fca34ffaf9c6ee' 
  AND (
    token = 'oPcEiAC6itNgppxynE793nKCCsVtTR+qxSIWICOPAQc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022