UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm1OAJ/A7/qYmevBZMchUyWbsEjOxt6ZPFJ0T846GI+Q=' 
WHERE 
  key_id = '8cccd263de5ea537e82d67d7d448949c9a1149ef3e17516d53d487a763791227' 
  AND (
    token = 'm1OAJ/A7/qYmevBZMchUyWbsEjOxt6ZPFJ0T846GI+Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043