UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TV7x07ZKeR56CHYXOZVyCQLSqyR+gJTs6szgAwBbd/8=' 
WHERE 
  key_id = '2a2c938506518b6d38f8219996c1b7b30275001eab1af2436439a5cd5bf81722' 
  AND (
    token = 'TV7x07ZKeR56CHYXOZVyCQLSqyR+gJTs6szgAwBbd/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041