UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GI5ef5g8WvRm9bzVd62fDYG0P8IjNTOF2/zh5+YfoH8=' 
WHERE 
  key_id = '39f1bc2e8004cf63956a08061c1b12f34f4be4d91088fe342ab318b33c836887' 
  AND (
    token = 'GI5ef5g8WvRm9bzVd62fDYG0P8IjNTOF2/zh5+YfoH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015