UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dRHd++oNr3VHeGq85oOjmkrDYkze+Fwu9EjM+9GpN4Q=' 
WHERE 
  key_id = '84775d1ead53c9b342a03d55f79d6811396c01b52c49e9d8fa9636e4cc8d871d' 
  AND (
    token = 'dRHd++oNr3VHeGq85oOjmkrDYkze+Fwu9EjM+9GpN4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017