UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'klfJ3oohUalC+SdEAgATMXTHcw8F2JpYmAxRjT+o1SE=' 
WHERE 
  key_id = '60ebd865f03bd554952c930001e8d4b6a8ca055276ae2a976082081723563b76' 
  AND (
    token = 'klfJ3oohUalC+SdEAgATMXTHcw8F2JpYmAxRjT+o1SE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024