UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uIMm/C5bxlCZzQTMZxnWf3+Z1rUrJ20q6duCT9TXS9Q=' 
WHERE 
  key_id = '386b7364181775a196d661c4c99b33a9f1fd785f17a072f53f4486b9a2e16276' 
  AND (
    token = 'uIMm/C5bxlCZzQTMZxnWf3+Z1rUrJ20q6duCT9TXS9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020