UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LA8g5x4EGOMYrV3mnXwTGFPbYuIqdHHXMNIx3gJIyZQ=' 
WHERE 
  key_id = '8f74c8efc42c94253970b10d805a64988b2270bf0542bf09a4e9506deee53603' 
  AND (
    token = 'LA8g5x4EGOMYrV3mnXwTGFPbYuIqdHHXMNIx3gJIyZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035