UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZSoPA/lyqcWb3hXMe1zuxBJyZtA6xFcoK8v8ec6vey8=' 
WHERE 
  key_id = '40ddb08a8823b16ad0e668de4ce493785e8d39789c8ee736685a21996da1b70d' 
  AND (
    token = 'ZSoPA/lyqcWb3hXMe1zuxBJyZtA6xFcoK8v8ec6vey8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033