UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lytYeDya3Xt8rLApCWssrtOPtLJjNbZX88aZaws6c14=' 
WHERE 
  key_id = '557265b8e3d766d3cb24757e978058b2068efcb9b8db798812f718c6ff416188' 
  AND (
    token = 'lytYeDya3Xt8rLApCWssrtOPtLJjNbZX88aZaws6c14=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017