UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cjOnliecQnsDil2sDTRaivt687l6jxGAB21O1CtKGA8=' 
WHERE 
  key_id = '21419f4e822bc65d7854302132a50152296da39da4193b96912d33ee0a2bb850' 
  AND (
    token = 'cjOnliecQnsDil2sDTRaivt687l6jxGAB21O1CtKGA8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042