UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XBR8tuUKszO0sdAL1Imq5JnnXVz+T+aaxIL4nDsd3BU=' 
WHERE 
  key_id = '50ad6829bec9f93f2ef8f53885183375d05e29ac9bd91e2a86406953b1249d0b' 
  AND (
    token = 'XBR8tuUKszO0sdAL1Imq5JnnXVz+T+aaxIL4nDsd3BU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052