UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UtQeUdF2G5a9awhjVnY+q1Zb5SRlHdSoYg8Z7z4H6B8=' 
WHERE 
  key_id = '30f337e8b6d36394891a63dc575c37222514d66347c687ab89a33557a40d66a0' 
  AND (
    token = 'UtQeUdF2G5a9awhjVnY+q1Zb5SRlHdSoYg8Z7z4H6B8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023