UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+hOySsm+WY9FMGOhtDhiq9ju5quCPmMfrS2JBrTceig=' 
WHERE 
  key_id = '818d2500952c0f6a7c341a8eae8bfee0af769dd79487d864f9cfa1faf5843ea2' 
  AND (
    token = '+hOySsm+WY9FMGOhtDhiq9ju5quCPmMfrS2JBrTceig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051