UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EAON5LxDrGd8RweAcM6jzTuY8X7PCbJzVTYmKAztMMI=' 
WHERE 
  key_id = 'a763b439b14112bf74faf7f3d3f343fcac454c6950d2c5e7dd08fe2667f2e969' 
  AND (
    token = 'EAON5LxDrGd8RweAcM6jzTuY8X7PCbJzVTYmKAztMMI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025