UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qwf1F/2HhIOGaLLOK9kKkNasJSv4JLspun2RZNActHo=' 
WHERE 
  key_id = '28de4992b2ce4afbd1018fdab28b6c6717ef4ecb52ab90726cdb5936895d6d2d' 
  AND (
    token = 'qwf1F/2HhIOGaLLOK9kKkNasJSv4JLspun2RZNActHo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037