UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dL18yTvAs1o4grnDQGFWbgrC8T/0qxpfM72odVqNHAc=' 
WHERE 
  key_id = '1c11c96559b87146854429dc7c01c5c595722373c89beb2c4fb21b3618c3bd20' 
  AND (
    token = 'dL18yTvAs1o4grnDQGFWbgrC8T/0qxpfM72odVqNHAc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030