UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W5CNmdN039M6X9U2MtgB/U5VJVH8lhpaG73zsK+6wpI=' 
WHERE 
  key_id = '217ce3a80ffc014dc03ec1b3e8514cd5127f5dfe2714d28e47600ae67033ada3' 
  AND (
    token = 'W5CNmdN039M6X9U2MtgB/U5VJVH8lhpaG73zsK+6wpI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034