UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q+BxFKDx0OEDQpYWDXadVP5DTf0Cqzq57SQgr8Wf0gs=' 
WHERE 
  key_id = '7f9e5b57fa76097cd1cb16a10e0f3bc5b162ac01c9147101eb91e08ff661374f' 
  AND (
    token = 'q+BxFKDx0OEDQpYWDXadVP5DTf0Cqzq57SQgr8Wf0gs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027