UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TNJLQRcfOym38nDb759Z244kw2YObj1fLSZPTGh5Ido=' 
WHERE 
  key_id = '6ea5208907275638259b7e15d69c0fc321c79046a87162c49c372bddc30ad209' 
  AND (
    token = 'TNJLQRcfOym38nDb759Z244kw2YObj1fLSZPTGh5Ido=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028