UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5f1gNQnT5tp0XmfJ5bpgdn5B0h6sDwM+VPKfIMn4pdU=' 
WHERE 
  key_id = '2c717aa5dd25ee3378bbb867792a9c8cf5407aab9fccc3df52732ef2ef445c2e' 
  AND (
    token = '5f1gNQnT5tp0XmfJ5bpgdn5B0h6sDwM+VPKfIMn4pdU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038